<?php

#---+---------------+--------------+------+---------------------+------------------------------+----+--------+
# # |    column     |     type     | null |       default       |              pk              | fk | remark |
#---+---------------+--------------+------+---------------------+------------------------------+----+--------+
# 1 | s_id          | int(11)      | NO   | [NULL]              | PRIMARY                      |    |        |
#   |               |              |      |                     |  <- wf_site_domains(sd_s_id) |    |        |
# 2 | s_name        | varchar(255) | NO   |                     |                              |    |        |
# 3 | s_create_date | datetime(19) | NO   | 1900-01-01 00:00:00 |                              |    |        |
#---+---------------+--------------+------+---------------------+------------------------------+----+--------+

class Site extends AppModel
{
  var $name = 'Site';
  var $useTable = "sites";
  var $id = "s_id";
  var $primaryKey = "s_id";

  function get_sites()
  {
		$rows = $this->findAll(null, "s_id, s_name, s_url, s_create_date, s_user_id", "s_name", null, 1, null);
		return $rows;
	}

	function getFieldValue($field, $key, $key_value)
	{
		$rows = $this->field($field, array("$key" => "$key_value"));
		return $rows;
  }

  function getFieldsValue($whereArray, $fields)
  {
		$rows = $this->find($whereArray, $fields, null, null);
		return $rows;
  }

  function setPrimaryKey ($key)
  {
    $this->primaryKey = $key;
  }

  function get_list_sites()
  {
    return $this->generateList(null, "s_name", null, "{n}.Site.s_id", "{n}.Site.s_name");
  }

}
?>
